import request from '/@/utils/request'

/**
 * 获取会议室列表
 * @param params 查询参数
 * @returns Promise
 */
export const getConferenceRoomList = (params: { date?: string; page?: number; limit?: number }) => {
  return request({
    url: '/api/conferenceRoomManagement/list',
    method: 'get',
    params,
  })
}

/**
 * 获取会议室详情
 * @param id 会议室ID
 * @returns Promise
 */
export const getConferenceRoomDetail = (id: string | number) => {
  return request({
    url: '/api/conferenceRoomManagement/detail',
    method: 'get',
    params: { id },
  })
}

/**
 * 获取所有会议室
 * @param params 查询参数（可选，包含location和date）
 * @returns Promise
 */
export const getAllConferenceRooms = (params?: { location?: string; date?: string }) => {
  return request({
    url: '/api/conferenceRoomManagement/all',
    method: 'get',
    params,
  })
}

/**
 * 预约会议
 * @param data 预约数据
 * @returns Promise
 */
export const reserveMeeting = (data: any) => {
  return request({
    url: '/api/conferenceInformation',
    method: 'post',
    data,
  })
}

/**
 * 取消会议预约
 * @param id 预约ID
 * @returns Promise
 */
export const cancelMeeting = (id: string | number) => {
  return request({
    url: '/api/conferenceInformation',
    method: 'delete',
    params: { id },
  })
}
